﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.WMS.Domain.Entities.Supperrs
{
    /// <summary>
    /// 进货列表实体
    /// </summary>
    public class DbPurchaseList
    {
        /// <summary>
        /// 自增主键
        /// </summary>

        public int Id { get; set; }

        /// <summary>
        /// 进货单号
        /// </summary>
   
        public string OrderNo { get; set; }

        /// <summary>
        /// 进货日期
        /// </summary>
       
        public DateTime PurchaseDate { get; set; }

        /// <summary>
        /// 供应商ID（关联DB_supplier表）
        /// </summary>
        [ForeignKey("DbSupplier")]
        public int SupplierId { get; set; }

        /// <summary>
        /// 进货人
        /// </summary>
        [MaxLength(50)]
        public string Purchaser { get; set; }

        /// <summary>
        /// 商品信息JSON格式（包含product_id、name、quantity、unit_price等）
        /// </summary>
     
        [Column(TypeName = "json")]  // 对应数据库的JSON类型
        public string ProductsInfo { get; set; }

        /// <summary>
        /// 总金额
        /// </summary>
 
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 单据状态（默认：草稿）
        /// </summary>

        public string Status { get; set; } = "草稿";

        /// <summary>
        /// 备注
        /// </summary>
     
        public string Remark { get; set; }

    
    }

    /// <summary>
    /// 进货单中商品信息的JSON对象模型
    /// </summary>
    public class PurchaseProductInfo
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        public int ProductId { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 采购数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 采购单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 小计金额
        /// </summary>
        public decimal Subtotal { get; set; }
    }
}
